//
//  MYGTextInputView.swift
//  MYGrow
//
//  Created by 林矗 on 2024/4/2.
//

import UIKit
import QMUIKit

class MYGTextInputView: UIView {
    // MARK: - Property
    var placeholder: String = "" {
        didSet {
            textFiled.placeholder = placeholder
        }
    }
    
    
    
    // MARK: - init
    override init(frame: CGRect) {
        super.init(frame: frame)
        configUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: - UI
    private func configUI() {
        backgroundColor = .white
        addSubview(containerView)
        containerView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
            make.height.equalTo(100)
        }
        
        containerView.addSubview(textFiled)
        textFiled.snp.makeConstraints { make in
            make.left.right.equalToSuperview().inset(25)
            make.height.equalTo(46)
            make.centerX.centerY.equalToSuperview()
        }
    }
    
    // MARK: - Public funcs
    
    // MARK: - lazy load
    private lazy var containerView: UIView = {
        let view = UIView()
        view.backgroundColor = .white
        return view
    }()
    
    private lazy var textFiled: QMUITextField = {
        let tf = QMUITextField()
        tf.font = .medium(17)
        tf.keyboardType = .numberPad
        tf.textColor = .rgba(51, 51, 51)
        tf.layerCornerRadius = 23
        tf.backgroundColor = .white
        tf.layerBorderWidth = 0.5
        tf.layerBorderColor = .rgba(51, 51, 51)
        return tf
    }()
}
